package com.hbu.product.hbumallproduct.event;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @ProjectName: hbu-mall
 * @Package: com.hbu.product.hbumallproduct.event
 * @ClassName: SyncDataListener
 * @Author: zxh
 * @Description:
 * @Date: 2022/11/16 21:10
 * @Version: 1.0
 */
@Component
@Slf4j
@AllArgsConstructor
public class SyncDataListener {

    private BrandDataSynchronizer brandDataSynchronizer;
    private CategoryDataSynchronizer categoryDataSynchronizer;

    @EventListener
    public void brandEventListener(BrandEvent brandEvent) {
        log.debug("接受到数据:" +  brandEvent.getSource());
        brandDataSynchronizer.syncBrandData(brandEvent);
    }

    @EventListener
    public void categoryListener(CategoryEvent categoryEvent) {
        log.debug("接受到数据:" +  categoryEvent.getSource());
        categoryDataSynchronizer.syncCategoryData(categoryEvent);
    }


}
